/**
 * elancom Corporation copy right 2012 - 2015  
 *   
 * $Header$
 * $Id$
 * $Author$
 * $Date$
 * $Revision$
 */
package com.elancom.framework.web;

import javax.annotation.Resource;

import com.elancom.framework.component.Component;
import com.elancom.framework.component.ComponentException;
import com.elancom.framework.component.ComponentInvoker;
import com.elancom.framework.component.ComponentRepository;
import com.elancom.framework.component.Input;
import com.elancom.framework.component.InputFactory;
import com.elancom.framework.component.Output;

/**
 * @author elancom
 * @date 2012-7-16
 */
public class ComponentSupportController extends AbstractController {
	@Resource
	protected ComponentRepository componentRepository;

	@Resource
	protected ComponentInvoker componentInvoker;

	@Resource
	private InputFactory inputFactory;

	/**
	 * @param componentName
	 * @return
	 * @throws ComponentException
	 * @see com.elancom.framework.component.componentInvoker#execute(java.lang.String)
	 */
	protected Output execute(String componentName) throws ComponentException {
		return componentInvoker.execute(componentName);
	}

	/**
	 * @param componentName
	 * @param input
	 * @return
	 * @throws ComponentException
	 * @see com.elancom.framework.component.componentInvoker#execute(java.lang.String, com.elancom.framework.component.Input)
	 */
	protected Output execute(String componentName, Input input) throws ComponentException {
		return componentInvoker.execute(componentName, input);
	}

	protected Input createInput() {
		return inputFactory.create();
	}

	/**
	 * @param componentName
	 * @param input
	 * @return
	 * @throws ComponentException
	 * @see com.elancom.framework.component.ComponentInvoker#execute(com.elancom.framework.component.Component, com.elancom.framework.component.Input)
	 */
	public Output execute(Component componentName, Input input) throws ComponentException {
		return componentInvoker.execute(componentName, input);
	}

	/**
	 * @param input
	 * @return
	 * @throws ComponentException
	 * @see com.elancom.framework.component.ComponentInvoker#execute(com.elancom.framework.component.Component)
	 */
	public Output execute(Component input) throws ComponentException {
		return componentInvoker.execute(input);
	}
}
